const { DataTypes } = require('sequelize')
const seq = require('../db/seq')
// 创建模型（Model zd_user -> zd_users)
const Goods = seq.define('zd_goods', {
    // id 会被sequelize自动创建，管理
     id: {
        type: DataTypes.INTEGER,
        primaryKey: true,
        autoIncrement: true,
        comment: '用户id'
    },
    goods_name: {
        type: DataTypes.STRING,
        allowNull: false,
        comment: '商品名，唯一'
    },
    goods_price: {
        type: DataTypes.DECIMAL(10, 2),
        allowNull: false,
        comment: '价格'
    },
    goods_num: {
        type: DataTypes.INTEGER,
        allowNull: false,

        comment: '数量'
    },
    goods_img: {
        type: DataTypes.STRING,
        allowNull: false,
        comment: '图像URL'
    },
},
    { paranoid: true }
)
// 强制创建数据表
// Goods.sync({ force: true })
// console.log('goods表创建成功！')

module.exports = Goods